<?php
class SystemControl{
	
	public function updateSystem(fun $fun)
	{
		$id = $_POST['id'];
		$siteName = $_POST['siteName'];
		$siteDescript = $_POST['siteDescript'];
		$siteEmail = $_POST['siteEmail'];
		$siteEmailPassword = $_POST['siteEmailPassword'];
		$pageSize = $_POST['pageSize'];
		$siteUrl = $_POST['siteUrl'];
		$systemService = new SystemService();
        $system = $systemService->getSystem();
        $system->setPageSize($pageSize);
        $system->setSiteDescpribt($siteDescript);
        $system->setSiteName($siteName);
        $system->setSiteEmailPassword($siteEmailPassword);
        $system->setSiteEmail($siteEmail);
        $system->setId($id);
        $system->setSiteUrl($siteUrl);
        $dd = $systemService->updateSystem($system);
      //  $fun->alertMessage($dd, "../setSystem.php");
        if($systemService->updateSystem($system))
        {
        	$fun->addLog("更新了系统设置");
        	$fun->closeDB();
        	session_start();
        	$_SESSION['system']=serialize($system);
        	$fun->alertMessage("系统已经重新设置！", "../setSystem.php");
        }
        else
        {
        	$fun->addLog("更新了系统设置");
        	$fun->closeDB();
        	$fun->alertMessage("系统已经设置失败！", "../setSystem.php");
        }
	}
}

?>